Page({
  data: {
    userId: "",
    nickName: "",
  },
  onLoad() {
    wx.showShareMenu({
      withShareTicket: true, // 是否使用带 shareTicket 的转发
      menus: ["shareAppMessage", "shareTimeline"], // 需要显示的分享按钮
    });
    this.setData({ nickName: wx.getStorageSync("userInfo").nickName });
  },
  onShow() {
    this.setData({
      userId: wx.getStorageSync("loginInfo").userId,
    });
    if (typeof this.getTabBar === "function" && this.getTabBar()) {
      this.getTabBar().setData({ selected: 1 });
      let profile = this.selectComponent("#profile");
      profile.refreshData();
    }
  },
  onShareAppMessage(res) {
    return {
      title: `${this.data.nickName}的主页`,
      path: `/pages/home/otherProfile/index?userId=${
        wx.getStorageSync("loginInfo").userId
      }&nickName=${wx.getStorageSync("userInfo").nickName}`,
    };
  },
  async onPullDownRefresh() {
    let profile = this.selectComponent('#profile')
    profile.pullDownRefresh()
  },
  async onReachBottom() {
    let profile = this.selectComponent('#profile')
    profile.reachBottom()
  }
});
